package com.example.listmoudle.activity

import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.android.baselibrary.arouter.ArouterContains
import com.android.baselibrary.base.BaseActivity
import com.android.baselibrary.base.BaseAdapter
import com.android.baselibrary.base.BasePath
import com.example.listmoudle.R
import com.example.listmoudle.arouter.RecyclerPath
import com.example.listmoudle.databinding.ActivityListMainBinding
import com.example.listmoudle.databinding.ItemRecyclerBinding

/**

 */

@Route(path = ArouterContains.RECYCLE_MODEL)
class ListMainActivity : BaseActivity<ActivityListMainBinding>() {

    override fun getLayoutId(): Int = R.layout.activity_list_main

    override fun initView() {

    }

    override fun initListener() {
       /* mBinding.tvDiver.setOnClickListener {

            startActivity(Intent(this, StaggerListActivity::class.java))
        }
        mBinding.tvTop.setOnClickListener {
            startActivity(Intent(this, MountingListActivity::class.java))
        }
        mBinding.tvSliper.setOnClickListener {
            startActivity(Intent(this, SliperListActivity::class.java))
        }*/
        mBinding.recycleView.layoutManager = HorizontallyLayoutManager()
        mBinding.recycleView.adapter = object :BaseAdapter<BasePath,ItemRecyclerBinding>(){
            override fun getItemLayoutId(): Int  = R.layout.item_recycler

            override fun covert(binding: ItemRecyclerBinding, t: BasePath, position: Int) {
                binding.bean = t
                binding.tv.setOnClickListener {
                    ARouter.getInstance().build(t.path).navigation()
                }
            }

        }.setData(list)
    }

    private val list by lazy {
        mutableListOf(
            BasePath("RecyclerView吸顶效果", RecyclerPath.RECYCLE_MOUNTING_LIST),
            BasePath("RecyclerView瀑布流", RecyclerPath.RECYCLE_STAGGER_LIST),
            BasePath("RecyclerView实现探探效果", RecyclerPath.RECYCLE_SLIPER_LIST)
        )
    }


}